<?php 
Class Mail {
	private $to;
	private $toName;
	private $from;
	private $subject;
	private $body;
	
	function __construct($to = null, $toName = null, $from = null, $subject = null, $body = null) {
		if (!is_null($to)) {
			$this->to = $to;
		}
		if (!is_null($toName)) {
			$this->toName = $toName;
		}
		if (!is_null($from)) {
			$this->from = $from;
		}
		if (!is_null($subject)) {
			$this->subject = $subject;
		}
		if (!is_null($body)) {
			$this->body = $body;
		}
	}
	
	function send() {
		global $_SITE;
		$headers  = 'MIME-Version: 1.0' . "\r\n";
		$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
		
		// Additional headers
		$headers .= 'To: '.$this->toName.' <'.$this->to.'>'."\r\n";
		$headers .= 'From: '.$_SITE["domain"].' <'.$this->from.'>'."\r\n";
		//$headers .= 'Cc: birthdayarchive@example.com' . "\r\n";
		//$headers .= 'Bcc: birthdaycheck@example.com' . "\r\n";
		
		// Mail it
		return mail($this->to, $this->subject, $this->body, $headers);
	}
}
?>